<template>
  <the-table
    :columns="columns"
    uri="/a/agents"
    ref="table"
    :slots="['enableSlot', 'action']"
  >
    <template slot="enableSlot" slot-scope="{ row }">
      {{ row.enable ? '启用' : '禁用' }}
    </template>
    <span slot="action" slot-scope="{ row }">
      <a class="ant-dropdown-link" @click="$emit('on-edit', row)"
        ><a-icon type="edit" /> 编辑
      </a>
      <a class="ant-dropdown-link red ml-2" @click="$emit('on-draw', row)"
        ><a-icon type="red-envelope" /> 扣佣金
      </a>
    </span>
  </the-table>
</template>
<script>
import theTable from '@/components/theTable.vue'

const columns = [
  {
    title: 'ID',
    dataIndex: 'id',
    width: 55,
  },
  {
    title: '用户名',
    dataIndex: 'username',
    searchAble: true,
  },
  {
    title: '代理号',
    dataIndex: 'code',
    searchAble: true,
  },
  {
    title: '备注',
    dataIndex: 'remark',
  },
  {
    title: '联系方式',
    dataIndex: 'mobile',
  },
  {
    title: '可动币值',
    dataIndex: 'coins',
  },
  {
    title: '手续费',
    dataIndex: 'fee_ratio',
  },
  {
    title: '单笔奖励',
    dataIndex: 'tip',
  },
  {
    title: '买币解锁时间（分钟）',
    dataIndex: 'freeze_minutes',
  },
  {
    title: '注册时间',
    dataIndex: 'created_at',
    dataType: 'range',
    searchAble: true,
  },
  {
    title: '最近登录时间',
    dataIndex: 'login_at',
  },
  {
    title: '最近登录IP',
    dataIndex: 'login_ip',
  },
  {
    title: '状态',
    dataIndex: 'enable',
    scopedSlots: { customRender: 'enableSlot' },
  },
  {
    title: '操作',
    key: 'action',
    scopedSlots: { customRender: 'action' },
    width: 180,
  },
]

export default {
  components: { theTable },

  data() {
    return {
      columns,
    }
  },
  mounted() {},
  methods: {},
}
</script>
